package com.aaa.gs.config;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import com.netflix.loadbalancer.RoundRobinRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration //相当于 <beans></beans>
@SuppressWarnings("all")
public class MyRule {
    /**
     *
     *配置负载均衡策略
     */
    @Bean //<beans id='' class='com.netflix.loadbalancer.IRule'></beans>
    public IRule iRule(){
        //轮询RoundRobinRule
        //随机RandomRule
        return new RandomRule();
    }
}
